package Test.Learn;

import java.net.*;
import java.io.*;
public class Server {
    public static void main(String[] args) throws IOException{
        ServerSocket sc=new ServerSocket(12345);
        while(true){
            Socket sk=sc.accept();

            InputStream in=sk.getInputStream();
            OutputStream out=sk.getOutputStream();

            InputStreamReader ir=new InputStreamReader(in);
            OutputStreamWriter ow=new OutputStreamWriter(out);
            BufferedReader br=new BufferedReader(ir);
            BufferedWriter bw=new BufferedWriter(ow);

            String s=br.readLine();
            System.out.println(s+"来访");

            bw.write("你好 ");
            bw.newLine();
            bw.flush();

            sc.close();
        }
    }
}
